import { GET_ARTICLE_LIST, GET_CHANNEL_LIST } from '../constants'

const initValue = {
  channels: [],
  articles: {
    page: 1,
    per_page: 10,
    results: [],
    total_count: 0,
  },
}
export default function article(prevState = initValue, action) {
  switch (action.type) {
    case GET_CHANNEL_LIST:
      return {
        ...prevState,
        channels: action.payload,
      }
    case GET_ARTICLE_LIST:
      return {
        ...prevState,
        articles: action.payload,
      }
    default:
      return prevState
  }
}
